package com.liruo.treasureattic.common.model.dto.url;

import com.liruo.treasureattic.common.model.constant.TreasureAtticConstant;
import com.liruo.treasureattic.common.model.enume.HtmlImportSelectionEnum;
import lombok.Getter;
import lombok.ToString;
import org.springframework.web.multipart.MultipartFile;

import java.io.Serial;
import java.io.Serializable;

/**
 * @Author:liruo
 * @Date:2022-10-31-20:36:45
 * @Desc
 */
@ToString
@Getter
public class HtmlUrlImportReq implements Serializable {
    @Serial
    private static final long serialVersionUID = TreasureAtticConstant.TREASURE_ATTIC_VERSION;
    private MultipartFile html;
    /**
     * htmlImportSelectionEnum是一个枚举值， 传htmlImportSelection来选择
     *     TO_DEFAULT_FOLDER(0,"把解析结果直接放到默认folder下"),
     *     TO_NEW_FOLDER(1,"把解析结果直接放到新建的folder下"),
     *     SELF_ADJUST(2,"- 进行自我调整(把上传的与当前的进行重组)后再重新上传保存-结果返回后，前端应该再请求所有folder，这些folder会有点击就查询url的功能"),
     *     SELF_ADJUST_REUPLOAD(3, "自我调整的重新上传变化后的father关系的folder和url保存");
     */
    private Integer htmlImportSelection;
    private HtmlImportSelectionEnum htmlImportSelectionEnum;

    /**
     *  htmlImportSelection = 1 新建一个folder去接收导入的folder和url
     */
    private UrlFolderAddReq urlFolderAddReq;

    /**
     * htmlImportSelection = 3 自我调整的重新上传变化后的father关系的folder和url保存
     */
    private HtmlParseReUploadReq htmlParseReUploadReq;
    public HtmlUrlImportReq(MultipartFile html, Integer htmlImportSelection) {
        this.html = html;
        this.htmlImportSelectionEnum = HtmlImportSelectionEnum.select(htmlImportSelection);
    }
}
